package com.sophia.menuorder.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.provider.MediaStore.Images;

public class DishDao {
	
	public static Bitmap getImageFromAssetsFile(Context context, String fileName) {
		Bitmap image = null;
		AssetManager am = context.getResources().getAssets();
		try {
			InputStream is = am.open(fileName);
			image = BitmapFactory.decodeStream(is);
			is.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return image;
	}
	
	public static List<Bitmap> getImagesFromAssetsFile(Context context, String[] fileNames) {
		List<Bitmap> list = new ArrayList<Bitmap>();
		AssetManager am = context.getResources().getAssets();
		try {
			InputStream is = null;
			for (int i = 0; i < fileNames.length; i++) {
				is = am.open(fileNames[i]);
				Bitmap bitmap = BitmapFactory.decodeStream(is);
				list.add(bitmap);
			}
			is.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return list;
	}
}
